﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Net.Sockets;
using System.Text;

namespace amuudp
{
    internal class UdpCommon
    {
        public static readonly int DataMaxLength = 50 * 1024 - 24;

        public static readonly int DefaultPort = 8111;

        public static byte[] ByteCopy(byte[] sourceBytes, int sourceStartIndex, int length)
        {
            byte[] temp = new byte[length];
            Array.Copy(sourceBytes, sourceStartIndex, temp, 0, length);
            return temp;
        }

        public static int ByteCopyToInt(byte[] sourceBytes, int sourceStartIndex)
        {
            return BitConverter.ToInt32(ByteCopy(sourceBytes, sourceStartIndex, 4), 0);
        }
    }
}
